package sctu.edu.java.year2016.team01.zhuming.day20160605.chapter10_2;


import java.util.*;

/**
 * 分别向set集合和list集合中添加“A”“a”“c”“C”“a”5个元素，观察重复元素在list和set集合中能否成功添加。
 * Created by Administrator on 2016/6/12.
 */
public class Cet {
    public static void main(String[] args) {

        String num[] = {"A", "a", "c", "C", "a"};

        List list = new ArrayList();

        for (int i = 0; i < num.length; i++) {
            list.add(num[i]);
        }

        System.out.println("遍历list数组元素为：" +list);

        Set set = new HashSet();
        for (int j = 0; j < num.length; j++) {
            set.add(num[j]);
        }
        System.out.print("遍历set数组元素为：" + set);

    }
}